package 从前序与中序遍历序列构造二叉树;

public class Test {
 public static void main(String[] args) {
     Solution solution = new Solution();
     int[] preorder = {1,2,3};
     int[] inorder = {3,2,1};
     TreeNode root = solution.buildTree(preorder, inorder);
     System.out.print("Pre-order Traversal: ");
     preOrderTraversal(root);
     System.out.println();
 }

 public static void preOrderTraversal(TreeNode node) {
     if (node == null) {
         return;
     }
     System.out.print(node.val + " ");
     preOrderTraversal(node.left);
     preOrderTraversal(node.right);
 }
}
